package db_java;

import com.basicorm.annotations.ManyToOne;

public class Person {

	private String firstName;
	private String lastName;

    @ManyToOne(localColumn="company_id", foreignProperty="id")
    private Company company;

	Person(String firstName, String lastName, Company company) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.company = company;
	}

	@Override
	public String toString(){
		return "First name: " + firstName + "; Last name: " + lastName + "; Company name: " + company.getCompanyName();
	}

	public String getFirstName() {
		return firstName != null ? firstName : "";
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName != null ? lastName : "";
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}
}
